package com.aaa.ssm.controller;

import com.aaa.ssm.entity.Season;
import com.aaa.ssm.entity.Theme;
import com.aaa.ssm.service.SeasonService;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("season")
public class SeasonController extends BaseController{
    @Resource
    private SeasonService seasonService;
    @PostMapping("qeryAll")
    public Result queryAll(){
        return success(seasonService.queryAll());
    }


    /**
     * 分页带参查询
     * @param page
     * @return
     */
    @PostMapping("queryPage")
    public Result queryPage(@RequestBody Page<Season> page){
        return success(seasonService.queryPage(page));
    }
    @PostMapping("add")
    public Result add(@RequestBody Season season){
        return success(seasonService.add(season));
    }
    @PostMapping("update")
    public Result update(@RequestBody Season season){
        return  success(seasonService.update(season));
    }
    @PostMapping("delete/{code}")
    public Result deleteById(@PathVariable("code")Integer code){
        return  success(seasonService.deleteById(code));
    }
}
